<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class CI_States_spain_entity{
	var $current_dbprefix = "";
	var $CI;
	var $id = 0;
	var $region_code = '';
	var $region_code_alpha = '';
	var $region_name_spanish = '';
	 
	function __construct() {
		$this->CI= & get_instance();
		$this->current_dbprefix = $this->CI->db->dbprefix;
		$this->CI->db->set_dbprefix('default_');
	}
	function __destruct() {
		$this->CI->db->set_dbprefix($this->current_dbprefix);
	}
	function init($cmd, $input)
	{
		if($cmd == 'id')
		{
			$result = $this->CI->db->where('id',$input)->get(TBL_SPAIN_STATE)->result();
		}
		else
		{
			return false;
		}
		if( !empty($result) )
		{
			$this->id = $result[0]->id;
			$this->region_code = $result[0]->region_code;
			$this->region_code_alpha = $result[0]->region_code_alpha;
			$this->region_name_spanish = $result[0]->region_name_spanish;
			return $this;
		}
		return false;
	}
	
	function getId(){return $this->id;}
	function getRegionNameSpanish(){return $this->region_name_spanish;}	
	function getRegionCodeAlpha(){return $this->region_code_alpha;}
	function getRegionCode(){return $this->region_code;}
	
	
	//end class
}	